<template>
	<div id="barcharts">
		
	</div>
</template>

<script>
	import * as echarts from 'echarts'
	export default{
		props:{
			dataset:Array,
			title:String,
		},
		data:function(){
			return{
				options:"",
			}
			
		},
		mounted:function(){
			this.options={
				title:{text:this.title},
				legend:{},
				tooltip:{},
				dataset:{
					source:this.dataset
				},
				xAxis:{type:"category"},
				yAxis:{},
				series:[
					{
						type:'bar',
						encode:{
							x:"x",
							y:"y"
						}
					}
				]
			}
			var chart=echarts.init(document.getElementById("barcharts"))
			chart.setOption(this.options)
		}
	}
</script>

<style>
	#barcharts{
		width: 400px;
		height: 300px;
	}
</style>
